/*
 * Copyright (C) 2011 Drogolov Roman Olegovich <drull@drull.org.ru>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, see <http://www.gnu.org/licenses/>
 *
 */

#ifndef __QT_NOTIFY_DAEMON_NOTIFY_WIDGET_H__
#define __QT_NOTIFY_DAEMON_NOTIFY_WIDGET_H__

#include <vector>

#include <QLabel>
#include <QObject> // Q_OBJECT
#include <QString>
#include <QPoint>

class Message;
class QClickLabel;
class NotifyArea;
class QSignalMapper;
class QPushButton;
class QTimer;

class NotifyWidget : public QLabel
{
    Q_OBJECT
public:
    NotifyWidget(std::vector<Message*> &msgStack, NotifyArea *p, bool debug);
    void checkIfNeedToShow();
    void appendMsg(); //append msg's that can be appended

    void setMaxOpacity(double value) { maxOpacity = value; }
    void setMaxIconSize(int value) { maxIconSize = value; }
    void setWidgetStyle(const QString& value) { widgetStyle = value; }
    void setWidgetPosition(const QPoint& value) { position = value; }

public slots:
    void showWidget();
    void hideWidget(int reason = 4);
    void fadeWidget();
    void emitActionInvoked(QString actionId);

signals:
    void ActionInvoked(unsigned int, QString);

private:
    NotifyArea *parent;
    std::vector<Message*> &messageStack;
    QPoint position;
    QTimer *fadeTimer;
    QTimer *timer;
    QClickLabel *text;
    QClickLabel *icon;
    QPushButton *actionButton[10];
    QSignalMapper *signalMap;
    double maxOpacity;
    QString widgetStyle;
    int maxIconSize;
    bool debugMode;

};

#endif
